// log_test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

void Msg_test();
bool WINAPI MsgProcT_1(tcharc* wcsMsg, void* pUserData);
bool WINAPI MsgProcT_2(tcharc* wcsMsg, void* pUserData);

int _tmain(int argc, _TCHAR* argv[])
{
	Msg_test();

	getchar();
	return 0;
}

void Msg_test()
{
	tcout << _T("-------- Msg_test --------") << endl;

	cz_log_SetMsgFunctionT(MsgProcT_1, NULL);
	cz_log_MsgT(_T("123\n"));
	cz_log_MsgT(_T("%08x\n"), 0x9987);
	cz_log_MsgT(_T("%f\n"), 1.0045);

	tofstream tofs;
	tofs.open(cz_file_GetExeDirT() + _T("..\\Data\\Msg.txt"));
	cz_log_SetMsgFunctionT(MsgProcT_2, &tofs);
	cz_log_MsgT(_T("123\r\n"));
	cz_log_MsgT(_T("%08x\n"), 0x9987);
	cz_log_MsgT(_T("%f\n"), 1.0045);
	tofs.close();

	tcout << endl;
}

bool WINAPI MsgProcT_1(tcharc* tcsMsg, void* pUserData)
{
	tcout << tcsMsg;
	return true;
}

bool WINAPI MsgProcT_2(tcharc* tcsMsg, void* pUserData)
{
	tofstream* ptofs = (tofstream*)pUserData;
	(*ptofs) << tcsMsg;
	return true;
}




